package com.chixing.day14;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

public class StudentTest {
    public static void main(String[] args){
        LocalDate l1 = LocalDate.of(2010,9,1);
        LocalDate l2 = LocalDate.of(2011,9,2);
        LocalDate l3 = LocalDate.of(2013,9,2);
        LocalDate l4 = LocalDate.of(2011,9,3);
        LocalDate l5 = LocalDate.of(2012,9,2);

        Student stu = new Student(1001,"Smith","计算机",20,l1);
        Student stu1 = new Student(1002,"Peter","英语",23,l2);
        Student stu2 = new Student(1003,"Allen","物理",34,l3);
        Student stu3 = new Student(1004,"Linda","英语",23,l4);
        Student stu4 = new Student(1005,"Jerry",null,25,l5);

        List<Student> list = new ArrayList<Student>();
         list.add(stu);
         list.add(stu1);
         list.add(stu2);
         list.add(stu3);
         list.add(stu4);

         System.out.println(list);

         try{
             for(Student stud:list){
                 if(stud.getProbject() != null){
                     List<Student> list1 = new ArrayList<>();
                     list1.add(stud);
                     System.out.println(list1);
                 }
             }
         }catch (Exception e){
           e.printStackTrace();
         }
    }
}
